package com.fudan.run.ctx;

import java.util.HashMap;
import java.util.Map;

import com.fudan.cfg.base.DatasetDef;
import com.fudan.run.dataset.DatasetHandler;

public class DatasetContext extends EnvContext<DatasetDef, DatasetHandler<? extends DatasetDef>>{

	private Map<String,Class<? extends DatasetDef>> datasetCfgMap;
	private Map<String,Class<? extends DatasetHandler<? extends DatasetDef>>> datasetHandlerMap;

	public DatasetContext() {
		datasetCfgMap = new HashMap<>();
		datasetHandlerMap = new HashMap<>();
	}
	@Override
	public void addParser(String name,Class<? extends DatasetDef> parserClz) {
		datasetCfgMap.put(name, parserClz);
	}
	@Override
	public void addHandler(String name,Class<? extends DatasetHandler<? extends DatasetDef>> handlerClz) {
		datasetHandlerMap.put(name, handlerClz);
	}
	@Override
	public Class<? extends DatasetDef> getParser(String name) {
		return datasetCfgMap.get(name);
	}

	@Override
	public Class<? extends DatasetHandler<? extends DatasetDef>> getHandler(String name) {
		return datasetHandlerMap.get(name);
	}
}
